home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / udev-mtab < prev    next >
Encoding:
Text File  |  2010-10-26  |  1.1 KB  |  53 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          udev-mtab
  4. # Required-Start:    udev $local_fs
  5. # Required-Stop:     
  6. # Default-Start:     S
  7. # Default-Stop:
  8. # Short-Description: Add to mtab the entry for /dev.
  9. ### END INIT INFO
  10.  
  11. PATH="/sbin:/bin"
  12.  
  13. case "$1" in
  14.   start) ;;
  15.   stop|restart|force-reload) exit 0 ;;
  16.   *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2; exit 1 ;;
  17. esac
  18.  
  19. # copy the rules generated before / was mounted read-write
  20. for file in /dev/.udev/tmp-rules--*; do
  21.   dest=${file##*tmp-rules--}
  22.   [ "$dest" = '*' ] && break
  23.   cat $file >> /etc/udev/rules.d/$dest
  24.   rm -f $file
  25. done
  26.  
  27.  
  28. # if it's not, it's probably a symlink to /proc/mounts
  29. [ -w /etc/mtab ] || exit 0
  30.  
  31. # defaults
  32. tmpfs_size="10M"
  33. udev_root="/dev/"
  34.  
  35. if [ -e /etc/udev/udev.conf ]; then
  36.   . /etc/udev/udev.conf
  37. fi
  38.  
  39. # strip the trailing slash
  40. udev_root=${udev_root%/}
  41.  
  42. if mountpoint -q $udev_root; then
  43.   if ! grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab; then
  44.     mtabline="$(grep -E --no-messages "^[^ ]+ +$udev_root +(dev)?tmpfs +" /proc/mounts || true)"
  45.     if [ "$mtabline" ]; then
  46.       echo "$mtabline" >> /etc/mtab
  47.     fi
  48.   fi
  49. fi
  50.  
  51. exit 0
  52.  
  53.